package it.ap.sa.acqua.tank.service.converter;

import org.springframework.stereotype.Component;

import it.ap.sa.acqua.dao.beans.TAssTankPlantBean;
import it.ap.sa.acqua.dao.model.TAssTankPlant;
import it.ap.sa.core.util.IBeanPopulate;

/**
 * Converter tra {@link TAssTankPlant} e {@link TAssTankPlantBean}
 * @author Alessandro Paolillo
 * @date 21 ott 2016
 * @version 1.0
 */
@Component
public class TAssTankPlantConverter implements IBeanPopulate<TAssTankPlant, TAssTankPlantBean>{

	public TAssTankPlantConverter() {
	}

	/**
	 * @author Alessandro Paolillo
	 * @date 21 ott 2016
	 * @version 1.0
	 * @see it.eng.tz.core.util.IBeanPopulate#convertdbToPage(java.lang.Object)
	 */
	@Override
	public TAssTankPlantBean convertdbToPage(TAssTankPlant src) throws Exception {
		TAssTankPlantBean result = new TAssTankPlantBean();
		if (src.getId()!=null) result.setId(src.getId());
		if (src.getIdPlant()!=null) result.setIdPlant(src.getIdPlant());
		if (src.getIdTank()!=null) result.setIdTank(src.getIdTank());
		return result;
	}
	
	/**
	 * @author Alessandro Paolillo
	 * @date 21 ott 2016
	 * @version 1.0
	 * @see it.eng.tz.core.util.IBeanPopulate#convertpageToDb(java.lang.Object)
	 */
	@Override
	public TAssTankPlant convertpageToDb(TAssTankPlantBean src) throws Exception {
		TAssTankPlant result = new TAssTankPlant();
		if (src.getId()!=null) result.setId(src.getId());
		if (src.getIdPlant()!=null) result.setIdPlant(src.getIdPlant());
		if (src.getIdTank()!=null) result.setIdTank(src.getIdTank());
		return result;
	}

}
